/*
 * main.c
 *
 *  Created on: Jun 24, 2009
 *      Author: z1083248
 */
#include "circularbuffer.h"
#include "num_functions.h"
#include <stdio.h>
#include <stdbool.h>

int main()
{
   // Will create an optimized power of 2 circular buffer.
   circularBufferT * circBuffer = initCircularBuffer(16);
   circBuffer->printLifoBuffer();

   circBuffer->addToBuffer(1.0);
   circBuffer->addToBuffer(1.1);
   circBuffer->addToBuffer(1.2);
   circBuffer->addToBuffer(1.3);
   circBuffer->printLifoBuffer();
   circBuffer->addToBuffer(1.4);
   circBuffer->printLifoBuffer();
   circBuffer->addToBuffer(1.5);
   circBuffer->addToBuffer(1.6);
   circBuffer->addToBuffer(1.7);
   circBuffer->addToBuffer(1.8);
   circBuffer->addToBuffer(1.9);
   circBuffer->addToBuffer(1.10);
   circBuffer->addToBuffer(1.11);
   circBuffer->addToBuffer(1.12);
   circBuffer->addToBuffer(1.13);
   circBuffer->addToBuffer(1.14);
   circBuffer->addToBuffer(1.15);
   circBuffer->addToBuffer(1.16);
   circBuffer->addToBuffer(1.17);
   circBuffer->printLifoBuffer();
   circBuffer->addToBuffer(1.18);
   circBuffer->addToBuffer(1.19);
   circBuffer->printLifoBuffer();
   circBuffer->dispose();

   // Will create a general circular buffer.
   circBuffer = initCircularBuffer(13);
   circBuffer->printLifoBuffer();

   circBuffer->addToBuffer(1.0);
   circBuffer->addToBuffer(1.1);
   circBuffer->addToBuffer(1.2);
   circBuffer->addToBuffer(1.3);
   circBuffer->printLifoBuffer();
   circBuffer->addToBuffer(1.4);
   circBuffer->printLifoBuffer();
   circBuffer->addToBuffer(1.5);
   circBuffer->addToBuffer(1.6);
   circBuffer->addToBuffer(1.7);
   circBuffer->addToBuffer(1.8);
   circBuffer->addToBuffer(1.9);
   circBuffer->addToBuffer(1.10);
   circBuffer->addToBuffer(1.11);
   circBuffer->addToBuffer(1.12);
   circBuffer->printLifoBuffer();
   circBuffer->addToBuffer(1.13);
   circBuffer->printLifoBuffer();
   circBuffer->addToBuffer(1.14);
   circBuffer->printLifoBuffer();
   circBuffer->addToBuffer(1.15);
   circBuffer->addToBuffer(1.16);
   circBuffer->addToBuffer(1.17);
   circBuffer->printLifoBuffer();
   circBuffer->addToBuffer(1.18);
   circBuffer->addToBuffer(1.19);
   circBuffer->printLifoBuffer();
   circBuffer->dispose();

   return 0;
}
